<?php

declare(strict_types=1);

namespace App\Controller\WebApi\v1;

use App\Controller\AbstractController;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Service\AuthService\MnAppAuthService;
/**
 * 分销接口数据
 * @author Luoshumai
 * @Controller(prefix="/webapi/v1/login")
 */
class LoginController extends AbstractController
{
    /**
     * Inject();
     * @var MnAppAuthService
     */
    protected $mnAppAuthService;
    /**
     * 登录
     * @RequestMapping(path="index", methods="post")
     */
    public function index(RequestInterface $request) {
       return $this->mnAppAuthService->login(
          (string)$request->input('mobile'),
          (string)$request->input('password'),
          (string)$request->input('js_code'),
          (string)$this->mnAppAuthService->getIp(server()),
       );
    }
}
